{% extends "base.html" %}
    {% block extrastyle %}
    <style type="text/css">
        .comment_field {
             width: 100% ! important;
        }
        #comment_table {
             width: 99% ! important;
        }
        #comment_table th {
             width: 5%;
             padding-right:10px;
        }
        .better td {
             padding: 2px 2px;
        }
        .better th {
             vertical-align: middle;
        }
    </style>
    {% endblock %}
{% block extrajs %}
<script type="text/javascript" src="{{ MEDIA_URL }}js/DijitRelatedObjectLookups.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/clariadmin.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}javascript/etiquette.js"></script>
<script type="text/javascript" charset="utf-8">
    dojo.require('dijit.form.MultiSelect');
    dojo.require('dijit.form.CheckBox');
    function handle_data(data){
      tab = dojo.byId("{{ prefix }}extra_fields");
        dojo.forEach(dijit.findWidgets(tab), function(w) {w.destroyRecursive();});
        tab.innerHTML = data;
        dojo.parser.parse(tab);
    }
    dojo.addOnLoad(function(){
      dojo.connect(dijit.byId("id_{{ prefix }}-type"),"onChange",typeChanged);
    });
    function typeChanged(event)
    {
      dojo.byId("{{ prefix }}extra_fieldset").classList.remove("dijitHidden");
      select_box=dijit.byId("id_{{ prefix }}-type");
      dojo.xhrGet({
        url:"{% url clariadmin.views.ajax_extra_fields_form host_type_id=-1 prefix=prefix %}".replace('-1',select_box.item.value?select_box.item.value:-1),
        load: handle_data
      });
    }
    function confirmation_callback(myBool, form_id){
        if(myBool)
            postwith({delete: "true"}, dojo.byId(form_id));
    }
</script>
{% endblock %}

{% block content_title %}{{ form.hostname.value }} {{ form.ip.value }}{% endblock %}

{% block content %}
{% if form.security_can_view %}

{% if form.rootpw %}
<div id="chromecrypto_download" style="font-size: 2em; color: red; font-weight: bold; border: 1px solid red; display: none;">Vous devez installer <a href="{{ MEDIA_URL }}chromecrypto.crx">ChromeCrypto</a> pour voir les mots de passe root!</div>
<script type="text/javascript">
setTimeout( function() {
    console.log("cc: "+dojo.byId("chromecrypto_presence"));
    if (! dojo.byId("chromecrypto_presence")) {
        dojo.style("chromecrypto_download", "display", "block");
    }
}, 500);
</script>
{% endif %}{# rootpw #}

{% include "clariadmin/host_base.html" %}

{% else %}{# if security_can_view #}
<p>Aucune permission.</p>
{% endif %}
{% endblock %}
